package com.itheima02;

public class Phone {
    private String count;
    private String color;
    private double price;

    public Phone() {
    }

    public Phone(String count, String color, double price) {
        this.count = count;
        this.color = color;
        this.price = price;
    }

    public String getCount() {
        return count;
    }

    public void setCount(String count) {
        this.count = count;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Phone{" +
                "count='" + count + '\'' +
                ", color='" + color + '\'' +
                ", price=" + price +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Phone phone = (Phone) o;

        if (Double.compare(phone.price, price) != 0) return false;
        if (count != null ? !count.equals(phone.count) : phone.count != null) return false;
        return color != null ? color.equals(phone.color) : phone.color == null;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = count != null ? count.hashCode() : 0;
        result = 31 * result + (color != null ? color.hashCode() : 0);
        temp = Double.doubleToLongBits(price);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        return result;
    }
}
